/*
 * dictionary.h
 *
 *  Created on: Jul 26, 2010
 *      Author: Ofer
 */

#ifndef DICTIONARY_H_
#define DICTIONARY_H_


typedef struct {
	String word;
	int64 index; /* the index of the word in case insensitive order*/
} DictionaryRecord;

typedef struct Dictionary{
	DictionaryRecord* words_arr;
	int64 length;
}Dictionary;

extern Dictionary* the_dictionary;

Dictionary* get_the_dictionary();
Dictionary* create_dictionary_from_file(char* fileName);
void insert_string_arr_to_dictionary(String* str_arr, Dictionary* dict);
void insert_word_to_dictionary(String word, Dictionary* dict);
int64 num_of_case_insensitive_words_in_dictionary(Dictionary* d);
int64 num_of_case_insensitive_combinations_word(String word);
DictionaryRecord make_dictonary_record(String word, int64 index);
Dictionary* make_dictionary();
Dictionary* get_the_dictionary();
int DictionaryRecord_comparator(const void* elem1, const void* elem2);
void free_dictionary(Dictionary* d);
void free_dictionary_record(DictionaryRecord* d);
void print_dictionary(Dictionary* d);
int count_english_letters_in_word(String word);
bool is_English_letter(char c);


#endif /* DICTIONARY_H_ */
